program WhereIsPi;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  p, x1, y1 : real;
  n0, n, i : integer;
  fout1, fout2 : TextFile;

begin
  assignfile (fout1,'output.txt');
  AssignFile (fout2, 'output2.txt');
  rewrite (fout1);
  Rewrite (fout2);
  randomize;
  n0:= 0;
  n := 0;
  for i:= 0 to 1000000000 do
  begin
    x1 := 2*random;
    y1 := 2*random;
    if ((x1 - 1)*(x1-1) + (y1-1)*(y1-1)<=1) then
      n0 := n0+ 1;
    n := n + 1;
    if (n mod 1000 = 0) then
    begin
    writeln (fout1,  (pi - (n0/n)*4 ): 0 : 16);
    Writeln (fout2, n);
    end;
  end;
  CloseFile (fout1);
  CloseFile (fout2);
end.
